/* GUI CONVERTED from rssciq.p (converter v1.75) Tue Nov  7 07:30:21 2000 */
/* rssciq.p - Release Management Supplier Schedules                        */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                     */
/* All rights reserved worldwide.  This is an unpublished work.            */
/*F0PN*/ /*V8:ConvertMode=Report                                           */
/* REVISION: 7.3    LAST MODIFIED: 10/09/92     BY: WUG *G462*/
/* REVISION: 7.3    LAST MODIFIED: 10/18/93     BY: WUG *GG36*/
/* REVISION: 7.3    LAST MODIFIED: 04/09/95     BY: vrn *G0MD*/
/* REVISION: 8.6E   LAST MODIFIED: 02/23/98     BY: *L007* A. Rahane        */
/* REVISION: 8.6E   LAST MODIFIED: 02/26/98     BY: *K1K0* Beena Mol        */
/* REVISION: 8.6E   LAST MODIFIED: 10/04/98     BY: *J314* Alfred Tan       */
/* REVISION: 9.1    LAST MODIFIED: 03/24/00     BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00     BY: *N0KP* Mark Brown       */
/* REVISION: 9.1    LAST MODIFIED: 10/06/00     BY: *N0RT* Jean Miller      */

/* SUPPLIER CALENDAR INQUIRY */

         /* DISPLAY TITLE */

/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

         {mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rssciq_p_1 "Non-Operating Days"
/* MaxLen: Comment: */

&SCOPED-DEFINE rssciq_p_3 "Description"
/* MaxLen: Comment: */

&SCOPED-DEFINE rssciq_p_10 "Supplier"
/* MaxLen: Comment: */

/*N0RT****
 * &SCOPED-DEFINE rssciq_p_5 " Operating Day Hour Exceptions "
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rssciq_p_9 "Sunday,Monday,Tuesday,Wednesday,Thursday,
 * Friday,Saturday"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rssciq_p_8 "Sunday"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rssciq_p_2 "Monday"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rssciq_p_6 "Tuesday"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rssciq_p_12 "Wednesday"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rssciq_p_11 "Thursday"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rssciq_p_4 "Friday"
 * /* MaxLen: Comment: */
 *
 * &SCOPED-DEFINE rssciq_p_7 "Saturday"
 * /* MaxLen: Comment: */
 *******************************/

/* ********** End Translatable Strings Definitions ********* */

/*GG36*/ define variable site as character label {&rssciq_p_10} no-undo.
         define variable frdate like oa_fr_date initial today   no-undo.
         define variable dname as character extent 7 format "x(10)" no-undo.
/*N0RT*  initial
 *       [{&rssciq_p_8}, {&rssciq_p_2}, {&rssciq_p_6}, {&rssciq_p_12},
 *        {&rssciq_p_11}, {&rssciq_p_4}, {&rssciq_p_7}]. */
/*N0RT*/ define variable c-days as character format "x(80)" no-undo.
         define variable i as integer no-undo.

         define buffer caldet for cal_det.

/*N0RT*/ /************* SET INITIAL VALUES ************* */
/*N0RT*/ dname[1] = getTermLabel("SUNDAY",10).
/*N0RT*/ dname[2] = getTermLabel("MONDAY",10).
/*N0RT*/ dname[3] = getTermLabel("TUESDAY",10).
/*N0RT*/ dname[4] = getTermLabel("WEDNESDAY",10).
/*N0RT*/ dname[5] = getTermLabel("THURSDAY",10).
/*N0RT*/ dname[6] = getTermLabel("FRIDAY",10).
/*N0RT*/ dname[7] = getTermLabel("SATURDAY",10).

/*N0RT*/ c-days = dname[1] + "," + dname[2] + "," + dname[3] + "," +
                  dname[4] + "," + dname[5] + "," + dname[6] + "," + dname[7].

         
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
/*GG36*/   site
           ad_name no-label
           frdate
         with frame a no-underline width 80 attr-space THREE-D /*GUI*/.

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



         /* SET EXTERNAL LABELS */
         setFrameLabels(frame a:handle).

         FORM /*GUI*/ 
            space(1)
            dname[1] no-label
            dname[2] no-label
            dname[3] no-label
            dname[4] no-label
            dname[5] no-label
            dname[6] no-label
            dname[7] no-label
            skip(0) space(1)
            shop_hours[1] no-label
            shop_hours[2] no-label
            shop_hours[3] no-label
            shop_hours[4] no-label
            shop_hours[5] no-label
            shop_hours[6] no-label
            shop_hours[7] no-label
         with STREAM-IO /*GUI*/  frame b side-labels width 80 no-attr-space.

         site = global_site.

/*K1K0*/ {wbrp01.i}

         repeat:

/*K1K0*/    if c-application-mode <> 'web' then
            update site frdate with frame a editing:

               if frame-field = "site" then do:
                  {mfnp05.i ls_mstr ls_addr "ls_type = ""suppcal""" ls_addr
                   "input site"}
                  if recno <> ? then do:
                     find ad_mstr where ad_addr = ls_addr no-lock no-error.
                     display ls_addr @ site ad_name with frame a.
                  end.
               end.
               else do:
                  status input.
                  readkey.
                  apply lastkey.
               end.
            end.

            status input.

/*K1K0*/    {wbrp06.i &command = update &fields = "  site frdate" &frm = "a"}

/*K1K0*/    if (c-application-mode <> 'web') or
/*K1K0*/       (c-application-mode = 'web' and
/*K1K0*/       (c-web-request begins 'data'))
            then do:

               hide frame c.
               hide frame h.

               find ad_mstr where ad_addr = site no-lock no-error.
               display
                  ad_name when (available ad_mstr)
                  "" when (not available ad_mstr) @ ad_name
               with frame a.

/*K1K0*/       find ls_mstr where ls_type = "suppcal" and ls_addr = site
/*K1K0*/       no-lock no-error.
/*K1K0*/       if not available ls_mstr then do:
/*K1K0*/          {mfmsg.i 5910 3} /* Address List Type not Created */
/*K1K0*/          if c-application-mode = 'WEB'  then return.
/*K1K0*/          else next.
/*K1K0*/       end.

               hide frame b no-pause.
               hide frame c no-pause.

/*K1K0*/    end.

            /* SELECT PRINTER */
            {mfselprt.i "terminal" 80}

/*K1K0*     find ls_mstr where ls_type = "suppcal" and ls_addr = site
 *          no-lock no-error.
 *          if not available ls_mstr then next. */

            find shop_cal no-lock
            where shop_site = site
            and shop_wkctr = "" and shop_mch = "" no-error.

            if available shop_cal then do:
               do i = 1 to 7:
                  display
                     dname[i]
                  with frame b STREAM-IO /*GUI*/ .
                  if shop_wdays[i] then
                  display
                     shop_hours[i]
                  with frame b STREAM-IO /*GUI*/ .
                  else
                  display
                     shop_wdays[i] @ shop_hours[i]
                  with frame b STREAM-IO /*GUI*/ .
               end.

               for each cal_det no-lock
               where cal_site = shop_site
               and cal_wkctr = shop_wkctr and cal_mch = shop_mch
               and (cal_end >= frdate or cal_end = ? or frdate = ?)
               break by cal_site by cal_wkctr by cal_mch by cal_ref
               with frame c:

/*G0MD*           form with frame c title "Operating Day Hour Exceptions" */
/*G0MD*/          FORM /*GUI*/  with STREAM-IO /*GUI*/  frame c title color normal
                  (getFrameTitle("OPERATING_DAY_HOUR_EXCEPTIONS",41))
                  no-attr-space width 80.

                  /* SET EXTERNAL LABELS */
                  setFrameLabels(frame c:handle).

                  if first-of (cal_ref) then do with frame c:

                     find caldet no-lock where
                          caldet.cal_site = cal_det.cal_site
                      and caldet.cal_wkctr = cal_det.cal_wkctr
                      and caldet.cal_mch = cal_det.cal_mch
                      and caldet.cal_ref = cal_det.cal_ref
                      and caldet.cal_start = ?
                      and (caldet.cal_end >= frdate
                        or caldet.cal_end = ? or frdate = ?)
                     no-error.
                     if available caldet then do with frame c:
                        display
                           caldet.cal_ref @ cal_det.cal_ref
                           caldet.cal_start @ cal_det.cal_start
                           caldet.cal_end @ cal_det.cal_end
                           caldet.cal_hours @ cal_det.cal_hours WITH STREAM-IO /*GUI*/ .
                        if not can-find (caldet where
                                         caldet.cal_site = cal_det.cal_site
                                     and caldet.cal_wkctr = cal_det.cal_wkctr
                                     and caldet.cal_mch = cal_det.cal_mch
                                     and caldet.cal_ref = cal_det.cal_ref)
                        then
                           down 1.
                     end.

                     for each caldet no-lock where
                              caldet.cal_site = cal_det.cal_site
                          and caldet.cal_wkctr = cal_det.cal_wkctr
                          and caldet.cal_mch = cal_det.cal_mch
                          and caldet.cal_ref = cal_det.cal_ref
                          and caldet.cal_start <> ?
                          and (caldet.cal_end >= frdate
                            or caldet.cal_end = ? or frdate = ?)
                     break by caldet.cal_site
                     with frame c:

                        display
                           caldet.cal_ref @ cal_det.cal_ref
                           caldet.cal_start @ cal_det.cal_start
                           caldet.cal_end @ cal_det.cal_end
                           caldet.cal_hours @ cal_det.cal_hours WITH STREAM-IO /*GUI*/ .
                        if last-of (caldet.cal_site) = no then
                           down 1.
                     end.
                  end.

               end.

               for each hd_mstr no-lock
               where hd_site = shop_site and hd_date >= frdate
               with frame h:
                  /* SET EXTERNAL LABELS */
                  setFrameLabels(frame h:handle).
/*K1K0*           disp  */
/*K1K0*/          display
                     hd_date
                     hd_desc label {&rssciq_p_3}
/*N0RT*              string(entry(weekday(hd_date),{&rssciq_p_9} )) */
/*N0RT*/             string(entry(weekday(hd_date),c-days ))
                     format "x(10)" no-label
                  with title (getFrameTitle("NON-OPERATING_DAYS",24))
                  width 80 STREAM-IO /*GUI*/ .
               end.

            end.

            {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

            {mfmsg.i 8 1}

         end.

/*K1K0*/ {wbrp04.i &frame-spec = a}
